Semiconductor image sensors are used for sensing light. Complementary metal-oxide-semiconductor (CMOS) image sensors (CIS) and charge-coupled device (CCD) sensors are widely used in various applications such as digital still camera or mobile phone camera applications. These devices utilize an array of pixels in a substrate, including photodiodes and transistors, to collect photon energy to convert images into electrical signals. Adjacent pixels are separated by a recess in the substrate, where the recess is part of an isolation structure. However, leakage current may occur as a result of the formation of the recess. Leakage current may cause defects in the image sensor, such as “white pixels.” To prevent leakage current, portions of the substrate beneath the recess may be implanted with a dopant. But there are competing practical considerations in fabricating the image sensor that make the dopant implantation difficult to implement. Thus, while existing methods of fabricating image sensors have been generally adequate for their intended purposes, they have not been entirely satisfactory in every aspect.